﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DataFrameworkSection.cs" company="CodePlex">
//   Copyright © CodePlex 2012
// </copyright>
// <summary>
//   Defines the DataFrameworkSection type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace DataFramework
{
    using System.Configuration;

    /// <summary>
    /// Class that defines a custom configuration section for any applications that use the data framework.
    /// </summary>
    public class DataFrameworkSection : ConfigurationSection
    {
        /// <summary>
        /// Gets or sets the type of the database.
        /// </summary>
        /// <value>The type of the database.</value>
        [ConfigurationProperty("databaseType", DefaultValue = "Unknown", IsRequired = true)]
        public DatabaseType DatabaseType
        {
            get
            {
                return (DatabaseType)this["databaseType"]; 
            }

            set
            {
                this["databaseType"] = value;
            }
        }

        /// <summary>
        /// Gets or sets the connection key.
        /// </summary>
        /// <value>The connection key.</value>
        [ConfigurationProperty("connectionName", DefaultValue = "", IsRequired = true)]
        public string ConnectionName
        {
            get
            {
                return (string)this["connectionName"];
            }

            set
            {
                this["connectionName"] = value;
            }
        }
    }
}
